<template>
	<div>
		<NavTabs :tabs="navTagList" v-model="activeTag"></NavTabs>
		<!-- <div class="btn tr w-100" id="no-print">
			<el-button type="primary" @click="printHtml('print_area')">打印</el-button>
		</div> -->
		<div class="config-content">
			
			<div class="report" :style="{width:nowRowData.approvalStatus ==1 || !nowRowData.approvalStatus?'100%':'65%'}">
				<!-- <ElderStayAllowance 
				id="print_area" 
				v-bind="$attrs" 
				:approvalStatus="nowRowData.approvalStatus"
				:isDetail="nowRowData.approvalStatus != 2 && nowRowData.approvalStatus !== undefined"
				:params="nowRowData"
				:key="tableKey" 
				:otherData="nowRowData" 
				:editData="nowRowData.ofsSubsidyApplyElderlyPO" 
				:editMode="editMode"></ElderStayAllowance> -->
				<ApplyReport
				    ref ="applyReport"
					:creditCode="userInfo.organizationId"
					v-bind="$attrs"
					:approvalStatus="nowRowData.approvalStatus"
					:isDetail="nowRowData.approvalStatus != 2 && nowRowData.approvalStatus !== undefined"
					:list="nowRowData.tableRel"
					:params="nowRowData"
					:nowRowData="nowRowData"
					:otherData="nowRowData" 
					:applyNo="nowRowData.applyNo"
					:editData="nowRowData.ofsSubsidyApplyElderlyPO" 
					:editMode="editMode"
					:key="tableKey"
				></ApplyReport>
			</div>
			<slot></slot>
		</div>
	</div>
</template>

<script setup lang="ts">
import { printHtml } from '@/utils/print'
import ApplyReport from '@/views/instOperate/components/ApplyReport/index.vue'
import ElderStayAllowance from '@/views/instOperate/components/ApplyReport/components/fiveTypeElder/ElderStayAllowance.vue'
import { getStore } from '@/utils/store'
import apiMod from '@/apiMod/index'

const props = defineProps<{
	nowRowData: any
}>()

let applyReport = ref()
const userInfo = getStore('userInfo') || {}
const activeTag = ref(2)
const params = ref({
	belongDate: props.nowRowData.belongDate,
	subsidyProjectId: props.nowRowData.subsidyProjectId,
	organizationId: userInfo.organizationId,
})

const navTagList = [
	{ label: '机构填报内容（申请表）', value: 2 },
	{ label: '机构填报内容（床位审核表）', value: 4 },
	{ label: '机构申请需要上传的材料', value: 3 },
]
// 判断一下老人户籍所在区和机构户籍所在区是不是一个
let editMode = reactive({
	crAreaSame:false,
	orgCrArea:false,
	elderCrArea:false,
	societyAudit:false,
	streetAudit:false,
	assessOrgAudit:false,
	civilAudit:false
})
let tableKey = ref(0)
watch(()=>props.nowRowData,(val)=>{
	if(val){
		if(val.ofsSubsidyApplyElderlyPO){
			tableKey.value = Math.random()
		}
		editMode.orgCrArea = true
		editMode.elderCrArea = true
	}
},{
	immediate:true,
	deep:true
})

const submit = () => {
	applyReport.value.onSave()
}
defineExpose({
	submit
})
</script>

<style scoped lang="scss">
.config-content {
	padding: 12px;
	margin-top: 20px;
	border: 1px solid #dcdcdc;
	border-radius: 10px;
  display: flex;
  .report {
    width: 70%;
  }
}
</style>
